const {userModel} =require("../mongodb");
const {success, fail} = require("../toast");


module.exports = function test (router){
//function text (router){
router.get("/content",async ctx=>{
    try {
        const data = await  contentrModel.find(ctx.request.body);
           return  success(ctx,data);
    } catch (error) {
           return fail(ctx,error)
    }
   
    
 })
 router.delete("/content",async ctx=>{
    try {
        const data = await  contentModel.deleteOne(ctx.request.body);
           return  success(ctx,data);
    } catch (error) {
           return fail(ctx,error)
    }
   
    
 })
 router.put("/content",async ctx=>{
    try {
        const data = await  contentModel.updateOne(ctx.query ,ctx.request.body);
           return  success(ctx,data);
    } catch (error) {
           return fail(ctx,error)
    }
   
    
 })

}


module.exports = function(router){
    router.get("/content",async ctx=>{
        ctx.body="content";
    })
    }